package com.example.park2212.patrol

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.lib_base.GlideUtils
import com.example.lib_base.entity.PatrolBeanItem
import com.example.park2212.R

class PatrolAdapter:BaseQuickAdapter<PatrolBeanItem,BaseViewHolder>(R.layout.item_patrol) {
    override fun convert(helper: BaseViewHolder, item: PatrolBeanItem) {
      helper.setText(R.id.patrol_name,item.patrolPerson)
        helper.setText(R.id.patrol_part,item.taskName)
        helper.setText(R.id.patrol_status,item.patrolStatus)
        helper.setText(R.id.patrol_time,item.patrolTime)

        val tv_status = helper.getView<TextView>(R.id.patrol_status)
        if (item.patrolStatus == "0"){
            tv_status.setText("未巡检")
            tv_status.setBackgroundResource(R.drawable.shape_solid_orange)
        }else if (item.patrolStatus == "1"){
            tv_status.setText("巡检中")
            tv_status.setBackgroundResource(R.drawable.shape_solid_darkgreen)
        }else if (item.patrolStatus == "2"){
            tv_status.setText("已完成")
            tv_status.setBackgroundResource(R.drawable.shape_zhanyong)
        }else if (item.patrolStatus == "3"){
            tv_status.setText("已作废")
            tv_status.setBackgroundResource(R.drawable.shape_weihu)
        }



    }
}